<script type="text/javascript" src="<?php echo base_url()?>js/back_end/adver.js"></script>
<link href="<?php echo base_url()?>css/calendar/calendar.css" rel="stylesheet" media="screen" type="text/css" />
<script type="text/javascript" src="<?php echo base_url()?>js/calendar/calendar.js"></script>
<script type="text/javascript">	
	call('contentText');
	$.metadata.setType("attr", "validate");
	$().ready(function() {
		$("#add").validate();
	});	
</script>
<style>
.selectText
{
	width: 70%;
}
.form-add label
{
	width: 20%;
}
.form-add input
{
	width: 65%;
}
.option-public
{
	position: relative; display: block; padding: 5px; height: 18px;
}
.option-public label
{
	width: 40%
}
.check-option
{
	width: 58%;
	float: left;
}
.check-option ul li
{
	float: left; padding-right: 15px; list-style: none outside none;
}
.category-select input
{
	vertical-align: middle;
}
.collapsed
{
	vertical-align: middle;
	padding-bottom: 8px;
}
.expanded
{
	vertical-align: middle;
	padding-bottom: 8px;
}
.btn-add
{
	float: right;
	margin-top: 5px;
	text-align: center;
	width: 50px;
	margin-right: 20px;
}
</style>          	
<div id="content-right" style="width: 100%;">
	<div id="add-product">
		<div id="sidebar-top-product" class="black">
			<div id="img-product" class="left white">
				<?php echo $title?>
			</div>
			<div id="img-back" class="right white">
				<a class="white" href="javascript:;" onclick="history.go(-1)">Quay lại trang trước</a> 
			</div>
			<div class="clear"></div>
		</div>
		<div class="form-product">
			<?php if (isset($_SESSION['error_add']) && !empty($_SESSION['error_add'])){?>
				<div class="form-add">
					<?php echo '<font style="color:red; text-align:center; font-size:15px;">'.$_SESSION['error_add'].'</font>'?>
				</div>
        	<?php }$_SESSION['error_add'] = NULL;?>				
			<form action="" method="post" name="add" id="add">
				<input type="hidden" id="base_url" name="base_url" value="<?php echo base_url()?>" />
            	<?php foreach ($news_edit as $edit){?>
	            	<div style="float: left; width: 67%">					
						<div class="form-add">
							<label class="left black">Tiêu Đề Tin Tức</label>
	                        <input type="text" name="title" class="required" value="<?php echo $edit['title']?>" />
						</div>
						<div class="form-add">
							<label class="left black">Ảnh</label>
							<input name="image" type="text" id="image" class="required" style="width: 65%;" value="<?php echo $edit['image']?>" />
							<a onclick="JavaScript:OpenFileManager('image','nama_article');" href="javascript:"><b style="color:blue;">Chọn ảnh</b></a>
						</div>
						<div class="form-add">
							<label class="left black">Miêu Tả </label>
							<textarea name="description" style="height: 100px; width: 65%;"><?php echo $edit['description']?></textarea>
						</div>                                    
						<div class="form-add">
							<label class="left black">Chi Tiết</label>
							<textarea name="contentText"><?php echo $edit['content']?></textarea>
						</div>
					</div>
					<div style="float: left; width: 33%">
						<div class="form-add">
							<label class="left black" style="width: 35%;">Tin HOT</label>
							<input type="checkbox" name="hot" <?php if ($edit['hot'] == 1) echo 'checked=checked';?> />
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Hiển thị</label>
							<div class="check-option" style="width: 65%; height: auto;">
								<ul>
									<li><input type="radio" name="status" value="1" <?php if ($edit['status'] == 1) echo 'checked=checked';?> /> Yes</li>
									<li><input type="radio" name="status" value="0" <?php if ($edit['status'] == 0) echo 'checked=checked';?> /> No</li>
								</ul>
							</div>
						</div>
						<div class="clear"></div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Thời gian bắt đầu</label>
							<input type="radio" name="type_startdate" value="1" onclick="Load_startdate();" style="width: auto; height: auto; margin-bottom: 0px;" /> Bắt đầu ngay
							<input type="radio" name="type_startdate" value="2" onclick="Load_startdate();" checked="checked" style="width: auto; height: auto; margin-bottom: 0px; margin-left: 20px;" /> Chọn ngày bắt đầu
							<input value="<?php echo date('m/d/Y', $edit['display_startdate'])?>" class="tcal" type="text" name="startdate" id="startdate" placeholder="Chọn thời gian bắt đầu" style="margin-left: 240px; margin-top: 5px; display: block; width: 170px; margin-bottom: 0px;" />
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Thời gian kết thúc</label>
							<input type="radio" name="type_enddate" value="1" onclick="Load_enddate();" style="width: auto; height: auto; margin-bottom: 0px;" /> Không giới hạn
							<input type="radio" name="type_enddate" value="2" onclick="Load_enddate();" checked="checked" style="width: auto; height: auto; margin-bottom: 0px; margin-left: 20px;" /> Chọn ngày kết thúc
							<input value="<?php echo date('m/d/Y', $edit['display_enddate'])?>" class="tcal" type="text" name="enddate" id="enddate" placeholder="Chọn thời gian kết thúc" style="margin-left: 240px; margin-top: 5px; display: block; width: 170px; margin-bottom: 0px;" />
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Meta Description</label>
							<textarea type="text" name="meta_description" class="required" style="width: 55%; height: 70px;"><?php echo $edit['meta_description']?></textarea>
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Meta Keywords</label>
							<textarea type="text" name="meta_keyword" class="required" style="width: 55%; height: 70px;"><?php echo $edit['meta_keyword']?></textarea>
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Tags </label>
							<textarea type="text" name="tag" class="required" style="width: 55%; height: 70px;"><?php echo $edit['tags']?></textarea>
						</div>
						<div class="form-add">
							<label class="left black" style="width: 35%;">Nguồn Tin</label>
							<input value="<?php echo $edit['source']?>" type="text" name="source" class="required" style="width: 60%;" />	                                    	
						</div>
					</div>
				<?php }?>								
				<div class="clear"></div>
				<div class="button-product">
					<input type="submit" class="submit-product" name="cmd" value="Update" style="color: #FFF; font-weight: bold; padding-bottom: 5px;" />
					<input type="reset" class="reset-product"  value='Cancel' style="color: #FFF; font-weight: bold; padding-bottom: 5px;" />
				</div>
				<div class="clear"></div>
			</form>
		</div>
	</div>
</div>                            